package com.shujia;

import java.io.BufferedReader;
import java.io.FileReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

public class MysqlTools {
    private static Connection conn;

    static{
        try {
            Properties properties = new Properties();
            properties.load(new BufferedReader(new FileReader("src/main/resources/")) );

            Class.forName(properties.getProperty("Driver"));
            String url = properties.getProperty("url" );
            String user = properties.getProperty("user");
            String password = properties.getProperty("password");
            conn = DriverManager.getConnection(url, user, password);
        }catch (Exception e) {
           e.printStackTrace();
        }
    }
    public static Connection getConnection(){
        return conn;
    }
}
